<template>
  <div class="layout-top">
    <div class="layout-top-item left">
      <div class="left-home">
        <span class="home-wrap">
          <i class="el-icon-s-home"></i>
        </span>
      </div>
      <div class="gap-wrap">
        <el-button size="mini" icon="my-icon icon-chart-trend-fill" :class="{selected: menuStatus.chart}" @click="onClick('chart')"></el-button>
        <el-button size="mini" icon="my-icon icon-map" :class="{selected: menuStatus.layer}" @click="onClick('layer')"></el-button>
        <el-button size="mini" icon="my-icon icon-adjust-fill" :class="{selected: menuStatus.config}" @click="onClick('config')"></el-button>
      </div>
    </div>
    <div class="layout-top-item center">

    </div>
    <div class="layout-top-item right">
      <div class="gap-wrap">
        <el-button size="mini" @click="onTest">
          <i class="my-icon icon-lcd"></i>
          图像
        </el-button>
        <el-button size="mini" @click="onPreview">
          <i class="my-icon icon-lcd"></i>
          预览
        </el-button>
        <el-button size="mini" @click="onSave">
          <i class="my-icon icon-save"></i>
          保存
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'layout-top',
  cnName: 'layout-top',
  props: {
    menuStatus: Object
  },
  data() {
    return {}
  },
  methods: {
    onClick(key) {
      this.$emit('onLayerClick', key)
    },
    onPreview() {
      this.$emit('preview')
    },
    onSave() {
      this.$emit('save')
    },
    onTest() {

    }
  }
}
</script>

<style lang="less" scoped>
.layout-top {
  height: 60px;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin: 0;
  font-size: 18px;
  line-height: 45px;
  background: var(--head-bg);
  z-index: 1;
  position: relative;
  border-bottom: 1px solid var(--bd-color);
  justify-content: space-between;

  &-item {
    display: flex;
    align-items: center;
    min-width: 400px;

    &.left {
      justify-content: start;
    }

    &.center {
      justify-content: center;
    }

    &.right {
      justify-content: right;
      padding: 0 20px;
    }

  }

  .gap-wrap {
    display: flex;
    justify-content: flex-start;
    gap: 8px 12px;
  }

  .home-wrap {
    color: var(--text-color);
    margin: 0 30px;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;

    &:hover {
      color: var(--menu-active-color);
      background-color: var(--menu-active-bg);
    }
  }

  /deep/.el-button {
    background: transparent;
    border-color: var(--top-btn-bd);
    padding: 5px 10px;
    border-radius: 5px;
    color: var(--text-color);

    &:hover, &.selected {
      border-color: var(--menu-active-color);
      color: var(--menu-active-color);
    }
  }


}
</style>
